package me.ywd.job;

import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.ddframe.job.api.simple.SimpleJob;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @Author Ye_Wenda
 * @Date 6/27/2017
 */
public class MyFirstElasticJob implements SimpleJob {

    private static final Logger log = LoggerFactory.getLogger(MyFirstElasticJob.class);

    @Override
    public void execute(ShardingContext context) {
        switch (context.getShardingItem()) {
            case 0:
                // do something by sharding item 0
                log.info("Hello World!");
                break;
            case 1:
                // do something by sharding item 1
                log.info("OK!");
                break;
            case 2:
                // do something by sharding item 2
                log.info("Shit!");
                break;
            // case n: ...
        }
    }
}
